package com.edu.compile.constant;

import java.util.Arrays;

/**
 * 比较符号
 *
 * @author yanzhao
 * @date 2021/10/22 18:37
 * @since 1.0.0
 */
public enum ComparatorEnum implements Comparator {

    eq("=="),
    neq("!="),
    gt(">"),
    gte(">="),
    lt("<"),
    lte("<="),
    eqn("==null"),
    non("!=null"),
    ;

    ComparatorEnum(String name) {
        this.name = name;
    }

    private String name;

    public String getName() {
        return name;
    }

    public static boolean exists(String name) {
        return Arrays.stream(ComparatorEnum.values()).anyMatch(c -> c.name.equals(name));
    }

}
